#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
int main()
{
    pid_t id = fork();
    if (id == 0)
    {
        const int x = 10;
        *x = 20;
    }
    else if (id > 0)
    {
        int status = 0;
        pid_t rid = waitpid(id ,&status, WNOWAIT);
        if (rid > 0)
        {
            printf("Wait for success! rid:%d\n", rid);
        }
        else
        {
            perror("wait");
            exit(errno);
        }
    }
    else
    {
        return 1;
    }
    return 0;
}
